package com.hsgene.user.service.api.impl;

import com.hsgene.common.util.exception.CommonErrorCode;
import com.hsgene.common.util.result.ApiResult;
import com.hsgene.generator.dto.GeneratorDto;
import com.hsgene.user.service.api.GeneratorService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class GeneratorServiceImpl implements FallbackFactory<GeneratorService> {

    @Override
    public GeneratorService create(Throwable cause) {
        return new GeneratorService() {
            @Override
            public ApiResult<GeneratorDto> getGenerator(String type, String prefix) {
                return ApiResult.fail(CommonErrorCode.GENERATOR_SERVICE_NOT_AVAILABLE);
            }
        };
    }
}
